/*
 * @Author: 胡海
 * @Date: 2020-02-10 19:39:49
 * @LastEditors: 胡海
 * @LastEditTime: 2020-03-08 15:32:07
 * @Description: 
 */
const Router = require('koa-router')
const {
    Auth
} = require('../../../middlewares/auth')

const {
    BuyOrder
} = require('../../models/buyOrder')
const {
    listValidator
} = require('../../validators/buyOrder')

const router = new Router({
    prefix: '/v1/buyOrder'
})


router.post('/list', new Auth().m, async (ctx) => { // 列表
    const v = await new listValidator().validate(ctx, {
        id: 'uid'
    })
    const data = await BuyOrder.list(ctx, v)
    ctx.body = {
        error_code: 0,
        msg: 'ok',
        data
    }
})

module.exports = router